package com.startup.yellocar.dto;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Id;

@Entity
@Table(name = "journey")
public class JourneyDTO {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "departure")
	private LocalisationDTO departure;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "arrival")
	private LocalisationDTO arrival;
	
	@Column(name = "code")
	private String code;
	
	@Column(name="type") 
	@Enumerated(EnumType.STRING)
	private JourneyTypeEnum type;
	
	@Column(name = "planneddate")
	private Date plannedDate;
	
	@Column(name = "price")
	private Long price;
	
	@Column(name = "totalseat")
	private int totalSeat;
	
	@Column(name = "availableseat")
	private int availableSeat;


	@Column(name = "datecreate", updatable = false, insertable = false)
	private Date dateCreate;

	
	
	
	
	public JourneyDTO() {
		super();
	}



	public JourneyDTO(String code, JourneyTypeEnum type, Date plannedDate,
			Long price, int totalSeat, int availableSeat) {
		super();
		this.code = code;
		this.type = type;
		this.plannedDate = plannedDate;
		this.price = price;
		this.totalSeat = totalSeat;
		this.availableSeat = availableSeat;
	}











	public Integer getId() {
		return id;
	}





	public void setId(Integer id) {
		this.id = id;
	}





	public LocalisationDTO getDeparture() {
		return departure;
	}





	public void setDeparture(LocalisationDTO departure) {
		this.departure = departure;
	}





	public LocalisationDTO getArrival() {
		return arrival;
	}





	public void setArrival(LocalisationDTO arrival) {
		this.arrival = arrival;
	}





	public String getCode() {
		return code;
	}





	public void setCode(String code) {
		this.code = code;
	}





	public JourneyTypeEnum getType() {
		return type;
	}





	public void setType(JourneyTypeEnum type) {
		this.type = type;
	}





	public Date getPlannedDate() {
		return plannedDate;
	}





	public void setPlannedDate(Date plannedDate) {
		this.plannedDate = plannedDate;
	}





	public Long getPrice() {
		return price;
	}





	public void setPrice(Long price) {
		this.price = price;
	}





	public int getTotalSeat() {
		return totalSeat;
	}





	public void setTotalSeat(int totalSeat) {
		this.totalSeat = totalSeat;
	}





	public int getAvailableSeat() {
		return availableSeat;
	}





	public void setAvailableSeat(int availableSeat) {
		this.availableSeat = availableSeat;
	}





	public Date getDateCreate() {
		return dateCreate;
	}





	public void setDateCreate(Date dateCreate) {
		this.dateCreate = dateCreate;
	}

	

}
